
// To represent a Cartesian Point
public class Point {
    // The x coordinate of a cartesian point
    int x;
    // The y coordinate of a cartesian point
    int y;
    
    // Constructor
    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
    
    // Overrides the equals method
    @Override
    public boolean equals(Object that) {
        if (that instanceof Point) {
            return this.x == ((Point) that).x &&
                    this.y == ((Point) that).y;
        }
        else {
            return false;
        }
    }
    
    // Overrides the hashCode method
    @Override
    public int hashCode() {
        return this.x * this.y;
    }

}
